{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Import required packages"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from __future__ import print_function\n",
    "import matplotlib.image as mpimg\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import sys\n",
    "import os\n",
    "from sklearn.datasets import fetch_mldata\n",
    "import random\n",
    "import cntk as C\n",
    "import cntk.tests.test_utils\n",
    "from sklearn.preprocessing import OneHotEncoder\n",
    "import argparse"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Define the parameters"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "num_training_samples = 60000 # Number of training samples\n",
    "batch_size = 64 # Number of mini-batch size\n",
    "num_epochs = 10 # Number of epochs of data for training\n",
    "initial_learning_rate = 0.1 # Initial learning rate\n",
    "train_log_iter = 500 # Number of iteration per training log"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Required Objects"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# Define the class for mini-batch reader in random fashion.\n",
    "class Batch_Reader(object):\n",
    "    def __init__(self, data , label):\n",
    "        self.data = data\n",
    "        self.label = label\n",
    "        self.num_sample = data.shape[0]\n",
    "\n",
    "    def next_batch(self, batch_size):\n",
    "        index = random.sample(range(self.num_sample), batch_size)\n",
    "        return self.data[index,:].astype(float),self.label[index,:].astype(float)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Loading Data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Load the data.\n",
    "mnist = fetch_mldata('MNIST original')\n",
    "\n",
    "# Create train & test data.\n",
    "train_data = mnist.data[:num_training_samples,:]\n",
    "train_label = mnist.target[:num_training_samples]\n",
    "test_data = mnist.data[num_training_samples:,:]\n",
    "test_label = mnist.target[num_training_samples:]\n",
    "\n",
    "# Transform train labels to one-hot style.\n",
    "enc = OneHotEncoder()\n",
    "enc.fit(train_label[:,None])\n",
    "onehotlabels_train = enc.transform(train_label[:,None]).toarray()\n",
    "\n",
    "# Call and create the ``train_reader`` object.\n",
    "train_reader = Batch_Reader(train_data, onehotlabels_train)\n",
    "\n",
    "# Transform test labels to one-hot style.\n",
    "enc = OneHotEncoder()\n",
    "enc.fit(test_label[:,None])\n",
    "onehotlabels_test = enc.transform(test_label[:,None]).toarray()\n",
    "\n",
    "# Call and create the ``test_reader`` object.\n",
    "test_reader = Batch_Reader(test_data, onehotlabels_test)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Network"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# Architecture parameters\n",
    "feature_dim = 784\n",
    "num_classes = 10\n",
    "num_hidden_layers = 3\n",
    "hidden_layer_neurons = 400\n",
    "\n",
    "# Place holders.\n",
    "input = C.input_variable(feature_dim)\n",
    "label = C.input_variable(num_classes)\n",
    "\n",
    "# Creating the architecture\n",
    "def create_model(features):\n",
    "    '''\n",
    "    This function creates the architecture model.\n",
    "    :param features: The input features.\n",
    "    :return: The output of the network which its dimentionality is num_classes.\n",
    "    '''\n",
    "    with C.layers.default_options(init = C.layers.glorot_uniform(), activation = C.ops.relu):\n",
    "\n",
    "            # Features are the initial values.\n",
    "            hidden_out = features\n",
    "\n",
    "            # Creating some identical hidden layers.\n",
    "            for _ in range(num_hidden_layers):\n",
    "                hidden_out = C.layers.Dense(hidden_layer_neurons)(hidden_out)\n",
    "\n",
    "            # Last layer connected to Softmax.\n",
    "            network_output = C.layers.Dense(num_classes, activation = None)(hidden_out)\n",
    "            return network_output\n",
    "\n",
    "# Initializing the model with normalized input.\n",
    "net_out = create_model(input/255.0)\n",
    "\n",
    "# loss and error calculations.\n",
    "loss = C.cross_entropy_with_softmax(net_out, label)\n",
    "label_error = C.classification_error(net_out, label)\n",
    "\n",
    "# Setup the trainer operator as train_op.\n",
    "learning_rate_schedule = C.learning_rate_schedule(initial_learning_rate, C.UnitType.minibatch)\n",
    "learner = C.sgd(net_out.parameters, learning_rate_schedule)\n",
    "train_op = C.Trainer(net_out, (loss, label_error), [learner])\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Training"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/sina/anaconda/envs/cntk-py35/lib/python3.5/site-packages/cntk/core.py:351: UserWarning: your data is of type \"float64\", but your input variable (uid \"Input3\") expects \"<class 'numpy.float32'>\". Please convert your data beforehand to speed up training.\n",
      "  (sample.dtype, var.uid, str(var.dtype)))\n",
      "/home/sina/anaconda/envs/cntk-py35/lib/python3.5/site-packages/cntk/core.py:351: UserWarning: your data is of type \"float64\", but your input variable (uid \"Input4\") expects \"<class 'numpy.float32'>\". Please convert your data beforehand to speed up training.\n",
      "  (sample.dtype, var.uid, str(var.dtype)))\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Minibatch: 0, Loss: 2.319, Error: 95.31%\n",
      "Minibatch: 500, Loss: 0.089, Error: 3.12%\n",
      "Minibatch: 1000, Loss: 0.217, Error: 6.25%\n",
      "Minibatch: 1500, Loss: 0.068, Error: 3.12%\n",
      "Minibatch: 2000, Loss: 0.019, Error: 0.00%\n",
      "Minibatch: 2500, Loss: 0.050, Error: 1.56%\n",
      "Minibatch: 3000, Loss: 0.038, Error: 0.00%\n",
      "Minibatch: 3500, Loss: 0.032, Error: 3.12%\n",
      "Minibatch: 4000, Loss: 0.016, Error: 0.00%\n",
      "Minibatch: 4500, Loss: 0.011, Error: 0.00%\n",
      "Minibatch: 5000, Loss: 0.040, Error: 1.56%\n",
      "Minibatch: 5500, Loss: 0.009, Error: 0.00%\n",
      "Minibatch: 6000, Loss: 0.043, Error: 1.56%\n",
      "Minibatch: 6500, Loss: 0.006, Error: 0.00%\n",
      "Minibatch: 7000, Loss: 0.009, Error: 0.00%\n",
      "Minibatch: 7500, Loss: 0.019, Error: 0.00%\n",
      "Minibatch: 8000, Loss: 0.004, Error: 0.00%\n",
      "Minibatch: 8500, Loss: 0.016, Error: 1.56%\n",
      "Minibatch: 9000, Loss: 0.006, Error: 0.00%\n"
     ]
    }
   ],
   "source": [
    "# Plot data dictionary.\n",
    "plotdata = {\"iteration\":[], \"loss\":[], \"error\":[]}\n",
    "\n",
    "# Initialize the parameters for the trainer\n",
    "num_iterations = (num_training_samples * num_epochs) / batch_size\n",
    "\n",
    "# Training loop.\n",
    "for iter in range(0, int(num_iterations)):\n",
    "\n",
    "    # Read a mini batch from the training data file\n",
    "    batch_data, batch_label = train_reader.next_batch(batch_size=batch_size)\n",
    "\n",
    "    arguments = {input: batch_data, label: batch_label}\n",
    "    train_op.train_minibatch(arguments=arguments)\n",
    "\n",
    "    if iter % train_log_iter == 0:\n",
    "\n",
    "        training_loss = False\n",
    "        evalaluation_error = False\n",
    "        training_loss = train_op.previous_minibatch_loss_average\n",
    "        evalaluation_error = train_op.previous_minibatch_evaluation_average\n",
    "        print(\"Minibatch: {0}, Loss: {1:.3f}, Error: {2:.2f}%\".format(iter, training_loss, evalaluation_error * 100))\n",
    "\n",
    "        if training_loss or evalaluation_error:\n",
    "            plotdata[\"loss\"].append(training_loss)\n",
    "            plotdata[\"error\"].append(evalaluation_error)\n",
    "            plotdata[\"iteration\"].append(iter)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYwAAAEZCAYAAACEkhK6AAAABHNCSVQICAgIf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VuXADdny2d0ev2vsvXfCwyVtDFpgMOz\nle5V0g4MZvWIz3dExKs51m+2lkFFB2DWjRuBH5Dunje8m3LLS+a7Sixr3b9A0nhSMvhIRCyXdBfw\nnh7GmGfdpWVWlqxjBat32jqvt/Q1UfJ4FWv+35a7L4OAEyNibukTkvYmHR8y6xW3MKwWdfzwXgac\nFxGP9eK1nR0iaZOsa+Y44C+kEVpfyZLFzqTbAXd4u+TA8J2kbqzNACRt2sN1d7X8b8Ae2fzHuyiz\nLidnMe1Puhvca8BtwJnvrlzavZd1m63BCcNqUQBExLyIuDhP2W4ed7if1BU1jdS99DBwK7CepMeA\n7wD/W1J+MjBD0hURMTN7/u6sm+c/e7jurpb/EDhd0kOkoam70l29b0l6GPgJ8A/Z8m+R3td0SY8C\n/9ZN3Wa5eXhzMzPLxS0MMzPLxQnDzMxyccIwM7NcnDDMzCwXJwwzM8vFCcPMzHJxwjAzs1ycMMzM\nLJf/DxGt5+X9Oe3JAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f4a65b6b518>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYwAAAEZCAYAAACEkhK6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XmcXFWZ//HPNyEJBEIIW4CEhE1AkFWWCCgtCAbZFBeW\nUVlGfoyCqKMCOuMQcQZQUBEZdZCwiYAgKOCIhEGaHSQESMAsQCCEhIQl7JEQkuf3x7lNKpWq7tvd\nVXWr0t/361WvrrvUPU/dun2fuufcc0oRgZmZWVf6FR2AmZm1BicMMzPLxQnDzMxyccIwM7NcnDDM\nzCwXJwwzM8vFCaNgkh6T9JECy99Y0uuSVFQMKwNJl0g6o9Gv7a3SsiXtJWlqD7fzS0n/VtvorNk4\nYRQsIj4QEXcCSDpd0uX1LE/S05L2KSl/dkSsGe6QA4Ck2yUd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MLBcnDDMzy8UJw8zMcvn/j8xQStYoijEAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f4a654effd0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.figure()\n",
    "plt.plot(plotdata[\"iteration\"], plotdata[\"loss\"], 'b--')\n",
    "plt.xlabel('Minibatch number')\n",
    "plt.ylabel('Loss')\n",
    "plt.title('iteration run vs. Training loss')\n",
    "plt.show()\n",
    "\n",
    "plt.plot(plotdata[\"iteration\"], plotdata[\"error\"], 'r--')\n",
    "plt.xlabel('Minibatch number')\n",
    "plt.ylabel('Label Prediction Error')\n",
    "plt.title('iteration run vs. Label Prediction Error')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Test"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Average test error: 1.82%\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/sina/anaconda/envs/cntk-py35/lib/python3.5/site-packages/cntk/core.py:351: UserWarning: your data is of type \"float64\", but your input variable (uid \"Input3\") expects \"<class 'numpy.float32'>\". Please convert your data beforehand to speed up training.\n",
      "  (sample.dtype, var.uid, str(var.dtype)))\n",
      "/home/sina/anaconda/envs/cntk-py35/lib/python3.5/site-packages/cntk/core.py:351: UserWarning: your data is of type \"float64\", but your input variable (uid \"Input4\") expects \"<class 'numpy.float32'>\". Please convert your data beforehand to speed up training.\n",
      "  (sample.dtype, var.uid, str(var.dtype)))\n"
     ]
    }
   ],
   "source": [
    "# Test data.\n",
    "test_minibatch_size = 256\n",
    "num_samples = 10000\n",
    "num_batches_to_test = num_samples // test_minibatch_size\n",
    "test_error = 0.0\n",
    "\n",
    "for i in range(num_batches_to_test):\n",
    "\n",
    "    # Read a mini batch from the test data file\n",
    "    batch_data, batch_label = test_reader.next_batch(batch_size=test_minibatch_size)\n",
    "\n",
    "    # Evaluate\n",
    "    arguments = {input: batch_data, label: batch_label}\n",
    "    eval_error = train_op.test_minibatch(arguments=arguments)\n",
    "\n",
    "    # accumulate test error\n",
    "    test_error = test_error + eval_error\n",
    "\n",
    "# Calculation of average test error.\n",
    "average_test_error = test_error*100 / num_batches_to_test\n",
    "\n",
    "# Average of evaluation errors of all test minibatches\n",
    "print(\"Average test error: {0:.2f}%\".format(average_test_error))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
